package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<b>
 *<li>Rule 46:  NewExpr ::= new ( AtomicExpr$VarPart , AtomicExpr$ModelPart , AtomicExpr$DomainPart , UserDefinedVarExpr$BaseContextPart )
 *</b>
 */
public class NewExpr extends Ast implements INewExpr
{
    private IAtomicExpr _VarPart;
    private IAtomicExpr _ModelPart;
    private IAtomicExpr _DomainPart;
    private UserDefinedVarExpr _BaseContextPart;

    public IAtomicExpr getVarPart() { return _VarPart; }
    public IAtomicExpr getModelPart() { return _ModelPart; }
    public IAtomicExpr getDomainPart() { return _DomainPart; }
    public UserDefinedVarExpr getBaseContextPart() { return _BaseContextPart; }

    public NewExpr(IToken leftIToken, IToken rightIToken,
                   IAtomicExpr _VarPart,
                   IAtomicExpr _ModelPart,
                   IAtomicExpr _DomainPart,
                   UserDefinedVarExpr _BaseContextPart)
    {
        super(leftIToken, rightIToken);

        this._VarPart = _VarPart;
        this._ModelPart = _ModelPart;
        this._DomainPart = _DomainPart;
        this._BaseContextPart = _BaseContextPart;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof NewExpr)) return false;
        if (! super.equals(o)) return false;
        NewExpr other = (NewExpr) o;
        if (! _VarPart.equals(other._VarPart)) return false;
        if (! _ModelPart.equals(other._ModelPart)) return false;
        if (! _DomainPart.equals(other._DomainPart)) return false;
        if (! _BaseContextPart.equals(other._BaseContextPart)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_VarPart.hashCode());
        hash = hash * 31 + (_ModelPart.hashCode());
        hash = hash * 31 + (_DomainPart.hashCode());
        hash = hash * 31 + (_BaseContextPart.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


